Skip to content

Conversation

@iRevive
Copy link
Contributor

@iRevive iRevive commented Oct 27, 2025

Motivation

In some cases, trailer classes are not needed and only add compilation overhead, especially with many services. They remain enabled by default, but an option is now available to disable them.

Comment on lines 89 to 90
val fs2GrpcDisableTrailers =
settingKey[Boolean]("Disable generation of the trailers")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative, we can extend CodeGeneratorOption.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would that look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a new option:

object CodeGenerationOptions {
  ...
  case object Fs2GrpcDisableTrailers extends CodeGeneratorOption {
    override def toString: String = "fs2_grpc:disable_trailers"
  }
}

Here is a complete example: iRevive#1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Not sure if that is preferable. Then we have two ways of customizing fs2grpc things, one for the serviceSuffix and one for fs2_grpc:disable_trailers, right?

Copy link
Contributor Author

@iRevive iRevive Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If we want to follow the new code-generation option path, we should deprecate fs2GrpcServiceSuffix and replace it with CodeGeneratorOption.Fs2GrpcServiceSuffix(suffix: String).

But I'm not sure it's worth it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CodeGeneratorOption is the recommendation then I think it is worth it. Now is the time to do breaking changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, let's move to CodeGeneratorOption then.

I will move fs2GrpcServiceSuffix to the CodeGeneratorOption in the follow-up PR. Let's deprecate the fs2GrpcServiceSuffix plugin key and keep it around for a while so that users can migrate.

@iRevive iRevive requested a review from ahjohannessen October 29, 2025 17:25
@ahjohannessen ahjohannessen merged commit 1aa5323 into typelevel:main Oct 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants